package com.cw.lang.validator.constraints;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import javax.validation.Constraint;
import javax.validation.Payload;

import com.cw.lang.validator.constraintvalidators.MobilePhoneCheckValidator;
import com.cw.lang.validator.constants.ValidatorConstants;

/**
 * 校验手机号码的规范
 *
 * @author zhengqy@yunrong.cn
 * @version V2.1
 * @since 2.1.0 2019/3/20 10:16
 */
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.CONSTRUCTOR})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(validatedBy = {MobilePhoneCheckValidator.class})
public @interface MobilePhoneCheck {

    /**
     * 校验失败是给出的默认提示
     *
     * @return
     */
    String message() default ValidatorConstants.CHECK_MOBILE_PHONE_MESSAGE;

    /**
     * 校验器，默认正则表达式
     *
     * @return
     */
    String regexp() default ValidatorConstants.CHECK_MOBILE_PHONE_REGEXP;

    /**
     * 分组
     *
     * @return 分组
     */
    Class<?>[] groups() default {};

    /**
     * payload
     *
     * @return payload
     */
    Class<? extends Payload>[] payload() default {};

}
